email me at borlaj@portlandschools.org
notes previous (09/07/06) submit the dump links  
 

Images

 

 

Easiest (although a lag might appear with constant animation [because it keeps loading the image])

 

            
        try
        {
            Image img = javax.imageio.ImageIO.read(this.getClass().getResource("test.png"));
            g.drawImage(img,200,200,null);
        }
        catch (Exception e){}
        
 

Better (this loads image just once):

 

Declare as a global

Image img;

Now in the constructor:

 

            
         try
        {
            img = javax.imageio.ImageIO.read(this.getClass().getResource("test.png"));
        }
        catch (Exception e){}
       
        

Now in the update:

 

            
        oG.drawImage(img,200,200,null);